import request from '@/router/axios'

export function fetchList(query) {
  return request({
    url: '/exam/project/notice/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/exam/project/notice',
    method: 'post',
    data: obj
  })
}

export function getNotice(id) {
  return request({
    url: '/exam/project/notice/' + id,
    method: 'get'
  })
}

export function getNoticeByProjectId(id) {
  return request({
    url: '/exam/project/notice/getByProjectId/' + id,
    method: 'get'
  })
}

export function findByProjectId(id) {
  return request({
    url: '/exam/project/notice/findByProjectId/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/exam/project/notice/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/exam/project/notice',
    method: 'put',
    data: obj
  })
}

export function submit(obj) {
  return request({
    url: '/exam/project/notice/submit',
    method: 'post',
    data: obj
  })
}

export function saveAttachments(obj) {
  return request({
    url: '/exam/project/notice/saveAttachments',
    method: 'post',
    data: obj
  })
}

export function submitAttachments(obj) {
  return request({
    url: '/exam/project/notice/submitAttachments',
    method: 'post',
    data: obj
  })
}

export function submitAudit(obj) {
  return request({
    url: '/exam/project/notice/submitAudit',
    method: 'post',
    data: obj
  })
}

export function auditSubmit(obj) {
  return request({
    url: '/exam/project/notice/auditSubmit',
    method: 'post',
    data: obj
  })
}

/**
 * 生成文书
 * @param obj
 * @returns {AxiosPromise}
 */
export function genNoticeWord(obj) {
  return request({
    url: '/exam/project/notice/genWord',
    method: 'post',
    data: obj
  })
}

export function getFileList(auditType) {
  return request({
    url: '/exam/project/notice/getDefaultNoticeAttachments/' + auditType,
    method: 'get'
  })
}
